package com.yxinsur.imc.business.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.IService;
import com.yxinsur.imc.business.domain.ApiBrokerOnline;
import com.yxinsur.imc.business.domain.ImcBroker;
import com.yxinsur.imc.business.excel.BrokerRelationTemplate;
import com.yxinsur.imc.business.excel.BrokerTemplate;
import com.yxinsur.imc.business.form.BrokerDimissionForm;
import com.yxinsur.imc.business.form.BrokerDimissionSearchForm;
import com.yxinsur.imc.business.form.BrokerSaveForm;
import com.yxinsur.imc.business.form.BrokerSearchForm;
import com.yxinsur.imc.business.vo.BrokerLeaveVo;
import com.yxinsur.imc.business.vo.BrokerVo;

/**
 * 代理人信息Service接口
 *
 * @author imc
 * @date 2021-03-18
 */
public interface IImcBrokerService  extends IService<ImcBroker>
{
    /**
     * 查询代理人信息
     *
     * @param id 代理人信息ID
     * @return 代理人信息
     */
    public BrokerVo selectImcBrokerById(String id);

    /**
     * 查询代理人信息列表
     *
     * @param broker 代理人信息
     * @return 代理人信息集合
     */
    public List<ImcBroker> selectImcBrokerList(BrokerSearchForm broker);

    /**
     * 新增代理人信息
     *
     * @param broker 代理人信息
     * @return 结果
     */
    public int insertImcBroker(BrokerSaveForm broker);

    /**
     * 修改代理人信息
     *
     * @param broker 代理人信息
     * @return 结果
     */
    public int updateImcBroker(BrokerSaveForm broker);

    /**
     * 批量删除代理人信息
     *
     * @param ids 需要删除的代理人信息ID
     * @return 结果
     */
    public int deleteImcBrokerByIds(Long[] ids);

    /**
     * 删除代理人信息信息
     *
     * @param id 代理人信息ID
     * @return 结果
     */
    public int deleteImcBrokerById(String id);

    /**
     * 新增离职信息
     * @param brokerForm
     * @return
     */
    public int insertImcBrokerDimission(BrokerDimissionForm brokerForm);

    /**
     * 离职信息查询
     * @param brokerForm
     * @return
     */
    public List<BrokerLeaveVo> selectImcBrokerDimissionList(BrokerDimissionSearchForm brokerForm);

    /**
     * 导入代理人信息
     * @param brokerList
     * @param updateSupport
     * @param operName
     * @return
     */
    String importBroker(List<BrokerTemplate> brokerList, boolean updateSupport, String operName);

    /**
     * 导入代理人信息校验
     * @param brokerList
     * @return
     */
    HashMap<String, Object> checkImportBroker(List<BrokerTemplate> brokerList);

    /**
     * 查询代理人基本信息+职级+推荐关系
     * @param broker
     * @return
     */
    ArrayList<BrokerVo> selectImcBrokerBaseInfo(BrokerSearchForm broker);

    /**
     * 代理人锁定状态
     * @param id
     * @param lock
     */
    void lockBroker(Long id, String lock);


    boolean checkBrokerCode(String brokerCode);

    /**
     * 查询团队下的代理人
     * @param teamId
     * @return
     */
    List<ImcBroker> selectBrokerByTeamId(Long teamId);

    /**
     * 获得当前租户下代理人最大工号
     * @return
     */
    String getMaxBrokerCode();

    /**
     * 导入代理人信息校验
     * @param brokerRelationList
     * @return
     */
    HashMap<String, Object> checkImportRelation(List<BrokerRelationTemplate> brokerRelationList);

    String importRelation(List<BrokerRelationTemplate> brokerRelationList);

    List<ApiBrokerOnline> choiceOnlineList(String fullName, Long orgId);

    int cancelDimission(Long brokerId);

    /**
     * 校验证件号码是否重复
     * @param certiCode
     * @return
     */
    boolean checkBrokerCertiCode(String certiCode);

    /**
     * 代理人删除校验
     * @param ids
     */
    void deleteCheck(Long[] ids);
}
